<template>
	<view>
		<view class="item">
			<view class="item_left" v-if="item.goods_big_logo">
				<image class="info" :src="item.goods_big_logo"></image>
				</view>
				<view class="item_left" v-else-if="shownum">
					<radio :checked="item.goods_state" @click="$emit('radio-click',item)" color="#C00000"></radio>
					<image class="info" :src="item.goods_small_logo"></image>
				</view>
					<view class="item_left" v-else>
						<image class="info" src="https://img01.yzcdn.cn/vant/cat.jpeg"></image>
			</view>
			<view class="item_right">
				<view class="item_right_header">
					<text>{{item.goods_name}}</text>
				</view>
				<view class="item_right_bottom">
					￥{{item.goods_price | toFixed}}
					<view class="number" v-if="shownum">
						<uni-number-box  :min="0" @change="changenum" v-model="item.goods_count"></uni-number-box>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-goods",
		data() {
			return {
				
			};
		},
		props: {
			item: {
				type: Object,
				default: {}
			},
			shownum: {
				type: Boolean,
				default: false
			}
		},
		created() {
			
		},
		methods: {
			changenum (val) {
				this.$emit('changenum',{
					goods_id: this.item.goods_id,
					goods_count: +val
				})
			}
		},
  filters: {
    toFixed(num) {
      return Number(num).toFixed(2)
    }
  }
	}
</script>

<style>
.goodlist_item {
	padding: 10px 5px;
}
.item {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: space-around;
	border-bottom: 1px solid #999999;
}
.item_left {
	display: flex;
	align-items: center;
	justify-content: space-around;
	margin-right: 10px;
}
.info {
	width: 100px;
	height: 100px;
	display: block;
}
.item_right {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-items: center;
}
.item_right_bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: #C00000;
	font-size: 16px;
}
.number {
	margin-left: 40px;
}
</style>
